-instance = program
-is_root = true

-content_for :widget_title do
  %i.grcicon-directive
  -unless program.company_controls?
    Directives
    %span.subtitle (Regulations, Contracts, Policies)
    and Controls
  -else
    Controls

-content_for :widget_help, 'program_directives'

-content_for :widget_id, 'program_directives_widget'

-content_for :widget_buttons do
  .filter
    .row-fluid
      .span6
        %input.ui-corner-all.widgetsearch-tocontent.clear-value(type='text' placeholder='Search')
      .span6
        .pull-right
          %a.btn.btn-add{ :href => new_flow_control_path(:'program_id' => instance.id), :'data-toggle' => 'modal-ajax-form', :'data-modal-reset' => 'reset', :'data-dirty' => '#controls, #combo', :'data-route' => "category_controls", :'data-modal-class' => 'modal-wide', :rel => "tooltip", :title => 'Create New Control' }
            %i.grcicon-add
            Control
        .pull-right
          -unless program.company_controls?
            .btn-group.left-dropdown.button-space
              %a{:'data-toggle'=>"dropdown", :href => "#", :class => "btn btn-add dropdown-toggle", :rel => "tooltip", :title => "Add/Remove Directives"}
                %i.grcicon-link-white
                Directives
              %ul.dropdown-menu
                %li.add-new-item
                  %a{:'data-modal-reset' => 'reset', :'data-toggle' => "modal-ajax-relationship-selector", :href => list_edit_flow_program_directives_path(:program_id => instance.id, :directive_meta_kind => :regulation), :'data-modal-class' => 'modal-wide', :'data-child-type' => 'directive', :'data-child-meta-type' => 'regulation', :'data-child-property' => 'directive_id' }
                    %i.grcicon-regulation-color
                    Regulation
                %li.add-new-item
                  %a{:'data-modal-reset' => 'reset', :'data-toggle' => "modal-ajax-relationship-selector", :href => list_edit_flow_program_directives_path(:program_id => instance.id, :directive_meta_kind => :contract), :'data-modal-class' => 'modal-wide', :'data-child-type' => 'directive', :'data-child-meta-type' => 'contract', :'data-child-property' => 'directive_id' }
                    %i.grcicon-contract-color
                    Contract
                %li.add-new-item
                  %a{:'data-modal-reset' => 'reset', :'data-toggle' => "modal-ajax-relationship-selector", :href => list_edit_flow_program_directives_path(:program_id => instance.id, :directive_meta_kind => :policy), :'data-modal-class' => 'modal-wide', :'data-child-type' => 'directive', :'data-child-meta-type' => 'policy', :'data-child-property' => 'directive_id' }
                    %i.grcicon-policy-color
                    Policy

.tabbable
  %ul.nav.nav-tabs
    -unless program.company_controls?
      %li.text-governance.active=link_to '<i class="grcicon-directive-color"></i>Directives'.html_safe, '#directives', :data => { :toggle => 'tab' }
    %li.text-governance=link_to '<i class="grcicon-control-color"></i>Controls'.html_safe, '#controls', :data => { :toggle => 'tab' }
    -#%li=link_to '<i class="grcicon-reg-map"></i>Combo'.html_safe, '#combo', :data => { :toggle => 'tab', :'tab-href' => flow_sections_path(:program_id => instance.id, :combo => true) }

  .action-items
    %a.expandAll.btn.btn-mini{:href => "#", :rel => "tooltip", :title => "Expand all"}
      %i.grcicon-wide-black
    %a.shrinkAll.btn.btn-mini{:href => "#", :rel => "tooltip", :title => "Collapse all"}
      %i.grcicon-normal-black

  .tab-content
    #directives.tab-pane
      %ul.tree-structure
    #controls.tab-pane
      %ul.tree-structure
    #combo.tab-pane
